<script>
var enable_submit = true;
$(function() {
    $('#user_repnum').rqDropDown({
        position: true,
        "datatype": "local",
        "source": get_repnums()
    });
    var obj = {
        "user_name": "由3至32位小写英文字母、数字、中划线构成。",
        "chap_name": "由3至32位字符构成。",
        "confirm_password": "CHAP密码由3至16位字符构成。",
        "chap_password": "确认密码与密码一致",
        'user_quota': '应为大于0的整数。'
    }
    bindMouseEvent('#user_create_modal', obj);
});
</script>
<div class="modal-header">
    <h3>[["user Create user"|translate]]</h3>
</div>
<div class="modal-body modal-body-height" id="user_create_modal">
    <div class="user-create-box">
        <div class="rtn-tip"></div>
        <table class="base-info">
            <tr>
                <td>
                    <label>用户名</label><a>*</a>
                </td>
                <td colspan="3">
                    <input type="text" style="display: none;">
                    <input type="password" style="display: none;">
                    <input type="text" name="user_name" id="user_name" autocomplete="off" />
                    <i class="fa fa-question-circle" itype="user_name"></i>
                </td>
            </tr>
            <tr>
                <td>
                    <label>密码</label><a>*</a>
                </td>
                <td>
                    <input type="password" name="add_passwd" id="add_passwd" onpaste="return false" oncontextmenu="window.event.returnValue=false" />
                </td>
                <td>
                    <label>确认密码</label><a>*</a>
                </td>
                <td>
                    <input type="password" name="re_add_passwd" id="re_add_passwd" onpaste="return false" oncontextmenu="window.event.returnValue=false" />
                    <i class="fa fa-question-circle" itype="chap_password"></i>
                </td>
            </tr>
            <tr>
                <td>
                    <label>用户类型</label><a>*</a>
                </td>
                <td>
                    <label>
                        <input type="radio" class="identity_radio" name="identity" value="tenancy" checked="true" />[["average user"|translate]]</label>
                    <label>
                        <input type="radio" class="identity_radio" name="identity" value="administrator" />[["super user"|translate]]</label>
                </td>
                <td></td>
                <td></td>
            </tr>
        </table>
	{% if not is_fusionnas %}
        <table class="super-info">
            <tr>
                <td>
                    <label>保护域</label>
                </td>
                <td>
                    {% for pd in pds %}
                    <label>
                        <input type="checkbox" class="user_pds" value="{{pd.id}}">{{pd.name}}</label>
                    {% endfor %}
                </td>
                <td>配额</td>
                <td>
                    <input type="text" name="quota" id="user_quota" />
                    <span class="unit">G</span>
                    <i class="fa fa-question-circle" itype="user_quota"></i>
                </td>
            </tr>
            <tr>
                <td>
                    <label>副本数</label>
                </td>
                <td>
                    <input id="user_repnum" readonly="readonly" class="rounded_dropdown" value='2' realvalue="2" />
                </td>
                <td></td>
                <td></td>
            </tr>
        </table>
        <table class="user-info">
            <tr>
                <td>
                    <label>[["label chap name"|translate]]</label><a>*</a>
                </td>
                <td>
                    <input type="text" name="chap_name" id="chap_name" />
                    <i class="fa fa-question-circle" itype="chap_name"></i>
                </td>
                <td>
                    <label>[["label chap password"|translate]]</label><a>*</a>
                </td>
                <td>
                    <input type="password" name="chap_password" id="chap_password" readonly onfocus="this.removeAttribute('readonly');" onpaste="return false" oncontextmenu="window.event.returnValue=false" />
                    <i class="fa fa-eye" style="right:60px"></i>
                    <i class="fa fa-question-circle" itype="confirm_password"></i>
                </td>
            </tr>
        </table>
       {% endif %}
        <div class="error-tip">
            <p></p>
            <span></span>
        </div>
        <div class="tip">
            <p></p>
            <span></span>
        </div>
    </div>
</div>
<!--.modal-body-->
<div class="modal-footer">
    <button class="btn btn-blue" ng-click="user_create()">[[ 'label ok'|translate ]]</button>
    <button class="btn btn-white" ng-click="cancel()">[[ 'label cancel'|translate ]]</button>
</div>
